<?php
	
	/**
	 * Verifies bootstrapper execution to ensure file
	 * necessities, and disabling direct access
	 */
	defined('ENGINE') or exit;
	
	/**
	 * Retrieve the users "real" ip address to the best
	 * of PHP's ability.  This attempts to override
	 * proxy websites
	 */
	function ip_address()
	{
		if(isset($_SERVER['HTTP_CLIENT_IP']) && is_valid_ip($_SERVER['HTTP_CLIENT_IP']))
		{
			return($_SERVER['HTTP_CLIENT_IP']);
		}
		else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && is_valid_ip($_SERVER['HTTP_X_FORWARDED_FOR']))
		{
			return($_SERVER['REMOTE_ADDR']);
		}
		
		return($_SERVER['REMOTE_ADDR']);
	}

?>